package org.graduation.recruitment.service.Impl.resume;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.graduation.recruitment.entity.pojo.resume.Resume;
import org.graduation.recruitment.entity.vo.ResumeVO;
import org.graduation.recruitment.mapper.resume.*;
import org.graduation.recruitment.service.resume.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> implements ResumeService {
    @Autowired
    private ResumeMapper resumeMapper;
    @Autowired
    private CampusExperienceMapper campusExperienceMapper;
    @Autowired
    private ProjectExperienceMapper projectExperienceMapper;
    @Autowired
    private InternshipExperienceMapper internshipExperienceMapper;
    @Autowired
    private EducationalBackgroundMapper educationalBackgroundMapper;

    @Override
    public ResumeVO getResumeAndAllResumeModels(Long resumeId) {
        ResumeVO resumeVO = ResumeVO.resume2NormalVO(resumeMapper.selectById(resumeId));
        resumeVO.setCampusExperiencesList(campusExperienceMapper.selectAllByResumeId(resumeId));
        resumeVO.setProjectExperiencesList(projectExperienceMapper.selectAllByResumeId(resumeId));
        resumeVO.setInternshipExperiencesList(internshipExperienceMapper.selectAllByResumeId(resumeId));
        resumeVO.setEducationalBackgroundsList(educationalBackgroundMapper.selectAllByResumeId(resumeId));
        return resumeVO;
    }
}
